Share module hỗ trợ SEO JohnCMS
Modules Seo
Mô tả: tối ưu hoá thẻ keywords & description
By Krite
- Mở forum/index.php Tìm
[c">$textl = mb_strlen ( $res [ 'text' ">) > 30 ? $hdr . '...' : $hdr ;
Thêm bên dưới
[c">if( $res [ 'type' ">== 't' ) {
$id_post = mysql_result ( mysql_query ( "SELECT MIN(`id`) FROM`forum` WHERE `type`= 'm' AND `refid`=' $id ';" ), 0 );
$q = mysql_fetch_assoc ( mysql_query ( "SELECT `text` FROM `forum` WHERE `id`= '" . $id_post . "' LIMIT 1;" ));
functions :: create_keywords ( $q [ 'text' ">, ', ' , 20 );
}
- Mở incfiles/classes/functions.php
thêm function bên dưới[c">public static function create_keywords ( $story , $separator = ', ' , $keyword_count = 20 ) {
global $set ;
$fastquotes = array ( "\x22" , "\x60" , " " , "
" , "\r" , '"' , "\" , '\r' , '
' , "-" , "{" , "}" , "[" , "">" );
$story1 = str_replace ( $fastquotes , " " , $story );
$story2 = preg_replace 0;
$story = preg_replace ";
$story3 = str_replace ( $fastquotes , '' , trim ( strip_tags ( str_replace ( '
' , ' ' , stripslashes ( $story1 ) ) ) ) );
$story3 = preg_replace ";
$set [ 'meta_desc' "> = mb_substr -8;
$arr = explode ( " " , $story );
foreach ( $arr as $word ) {
if-8 > 4 ) $newarr ["> = $word ;
}
$arr = array_count_values ( $newarr );
arsort ( $arr );
$arr = array_keys ( $arr );
$total = count ( $arr );
$offset = 0 ;
$arr = array_slice ( $arr , $offset , $keyword_count );
$set [ 'meta_key' "> = implode ( $separator , $arr );
}